<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body>div{
            width: 100px;
            height: 100px;
            background-color: red;
            overflow: hidden;  /* 解决粘连问题 */
        }
        div>div{
            width: 50px;
            height: 50px;
            background-color: green;
            margin-left: 20px;
            /*当元素的上边缘和上级元素的上边缘重叠时，给元素添加上外边距会出现粘连问题，
            给上级元素添加overflow:hidden*/
            margin-top: 20px;
        }
    </style>
</head>
<body>
<div>
    <div></div>
</div>
</body>
</html>